//
//  MenueViewController.m
//  App-MyFairldy
//
//  Created by 客官大大 on 15/5/23.
//  Copyright (c) 2015年 客官大大. All rights reserved.
//

#import "MenueViewController.h"
#import "HomepageViewController.h"
#import "AppDelegate.h"
#import "CategoryViewController.h"
#import "SeasonViewController.h"
#import "BrandViewController.h"
#import "LoginViewController.h"

#import "HealthViewController.h"

@interface MenueViewController ()

@end

@implementation MenueViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
            self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStylePlain target:self action:@selector(showMenu)];
//    self.view.backgroundColor = [UIColor redColor];
}
- (void)showMenu
{
    if (!_sideMenu) {
        RESideMenuItem *homeItem = [[RESideMenuItem alloc] initWithTitle:@"首页" action:^(RESideMenu *menu, RESideMenuItem *item) {
            HomepageViewController *viewController = [[HomepageViewController alloc] init];
            viewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
            [menu setRootViewController:navigationController];
        }];
        RESideMenuItem *cateItem = [[RESideMenuItem alloc] initWithTitle:@"类别" action:^(RESideMenu *menu, RESideMenuItem *item) {
            CategoryViewController *seaViewController = [[CategoryViewController alloc] init];
            seaViewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
            [menu setRootViewController:navigationController];
        }];
        RESideMenuItem *JiankangItem = [[RESideMenuItem alloc] initWithTitle:@"健康助手" action:^(RESideMenu *menu, RESideMenuItem *item) {
            HealthViewController *seaViewController = [[HealthViewController alloc] init];
            seaViewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
            [menu setRootViewController:navigationController];
        }];
        RESideMenuItem *SeasonItem = [[RESideMenuItem alloc] initWithTitle:@"季节" action:^(RESideMenu *menu, RESideMenuItem *item) {
            SeasonViewController *seaViewController = [[SeasonViewController alloc] init];
            seaViewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
            [menu setRootViewController:navigationController];
        }];
        RESideMenuItem *BrandItem = [[RESideMenuItem alloc] initWithTitle:@"品牌" action:^(RESideMenu *menu, RESideMenuItem *item) {
            BrandViewController *seaViewController = [[BrandViewController alloc] init];
            seaViewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
            [menu setRootViewController:navigationController];
        }];
        RESideMenuItem *LoginItem = [[RESideMenuItem alloc] initWithTitle:@"登录" action:^(RESideMenu *menu, RESideMenuItem *item) {
            LoginViewController *seaViewController = [[LoginViewController alloc] init];
            seaViewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
            [menu setRootViewController:navigationController];
        }];
        
        
        
        _sideMenu = [[RESideMenu alloc] initWithItems:@[homeItem,cateItem,JiankangItem,SeasonItem,BrandItem,LoginItem]];
        _sideMenu.verticalOffset = IS_WIDESCREEN ? 110 : 76;
        //        _sideMenu.hideStatusBarArea = [AppDelegate OSVersion] < 7;
    }
    
    [_sideMenu show];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
